#ifndef FGCOMM_H
#define FGCOMM_H

#include <sstream>
#include <vector>
#include <map>

class SerialPort;

class FgComm
{
public:
	FgComm();

	void setInterface(SerialPort *fg);
	void setNoiseMap(const std::map<std::string, float> &noiseMap);
	bool read();
	void write();

private:
	void parseValue();
	void updateProperties();
	void prepareWrite(std::stringstream &str);
	double getValue(int index);
	bool check();
	double noise(double a);

	SerialPort *fg_;
	std::stringstream str_;
	std::vector<double> values_;
	std::map<std::string, float> noiseMap_;
};


#endif
